from fastapi import FastAPI
import uvicorn
from src.common.logger import get_logger
from src.config.conf import cfg
from src.components.schedules import register_scheduler
from src.components.schedules import vpn_register_scheduler  #vpn环境或者非中国大陆服务器环境运行
from src.api.api import register_router
from concurrent_log_handler import ConcurrentTimedRotatingFileHandler  # 确保安装了这个库

app = FastAPI()
logger = get_logger(__name__)
app.state.logger = logger
register_scheduler(app)
# vpn_register_scheduler(app)
register_router(app)

if __name__ == "__main__":
    uvicorn.run(
        app="main:app",
        reload=cfg.server.server_reload,
        port=cfg.server.server_port,
        workers=cfg.server.server_workers,
    )
    pass
